package com.sky.mapper.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.pojo.Dish;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DishMapper {

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
    Integer countByCategoryId(Long categoryId);

    /**
     * 菜品分页查询
     * @param dishPageQueryDTO
     * @return
     */
    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    void updateStatus(@Param("id") Long id, @Param("status") Integer status, @Param("updateTime")LocalDateTime updateTime, @Param("updateUser")Long updateUser);

    Long countName(String dishName);

    void insert(Dish dish);

    Integer selectCountByIdsAndStatus(@Param("ids") List<Long> ids, @Param("status") Integer status);

    void deleteByIds(List<Long> ids);

    Dish getById(Long id);

    void update(Dish dish);

    List<Dish> getDishListByCategoryId(@Param("categoryId") Long categoryId,@Param("name") String name);
}
